﻿<head>
    <style type="text/css">
        .col-sm-4 {
            width: 314px;
        }

        #TeamTitle {
            width: 213px;
        }

        .auto-style1 {
            width: 176px;
        }
    </style>
</head>
<div class="container" data-ng-controller="incidentDetailCtrl" data-hmSwipeRight="ListOfIncidents()"  data-hmSwipeUp="LastIncident($event)" data-hmSwipeDown="NextIncident($event)">
<div id="loadingWidget" class="row-fluid ui-corner-all" style="padding: 0 .7em;" loading-widget >
        <div class="loadingContent">
            <p>
                <img alt="Loading  Content" src="images/ajax-loader.gif" /> Loading
            </p>
        </div>
    </div>
        <div class="row">
            <div class="row">
        <br />
    </div>
     <div class="row">
        <br />
    </div>
        <div class="panel panel-primary" title="Incident Info">
            <div data-ng-switch on="{{incidentId}}">
<!-- NEW -->
                <div data-ng-switch-when="0">
                    <div class="panel-heading">
                        <h3 class="panel-title">New - Incident Info</h3>
                    </div>
                    <div class="panel-body">
                        <form class="form-horizontal" role="form">
                            <div class="form-group">
                                <input type="hidden" ng-model="incident.id" value="{{incidentId}}" id="newincidentid" />
                                <label for="titleofincident" class="sr-only">Name of Incident</label>
                                <div class="col-sm-6">
                                    <input type="text" ng-model="incident.title" id="titleofincident" required placeholder="Name of Incident" class="form-control" />
                                </div>

                                <label for="dateofincidentnew" class="sr-only">Date of Incident</label>
                                <div class="col-sm-4">
                                    <input type="text"  date-time ng-model="incident.dateOfIndicent" placeholder="date of incident" id="dateofincidentnew" required view="hours" class="form-control" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="select2" class="col-sm-2 control-label">Team</label>
                                <div class="col-sm-8">
                                    <label data-ng-repeat="team in teams" class="radio-inline">
                                        <input type="radio" id="team" value="{{team.id}}" ng-model="incident.team_Id" >{{team.title}}
                                    </label>
                                </div>
                                
                            </div>
                            <div class="col-md-2 col-md-1-offset">
                                <button class="btn btn-primary" title="save" id="saveButton" type="submit" data-ng-click="addIncident()" data-ng-disabled ="form.$pristine || form$invalid" >
                                    Save                       
                                </button>
                            </div>
                            </form>
                    </div>
                </div>
<!--EXISTING-->
                <div ng-switch-default>
                    <div class="panel-heading">
                        <h3 class="panel-title">{{incident.title}} - Incident Info</h3>
                    </div>
                <div class="panel-body">
                    <form class="form-horizontal css-form" name="form" role="form">
                        <div class="form-group">
                         <label for="titleofincident" class="col-sm-2 control-label">Title</label>
                                <div class="col-sm-4">
                                    <input type="text" data-ng-model="incident.title" id="titleincidentedit" required placeholder="Name of Incident" class="form-control" />
                                </div>

                            <label for="dateofincident" class="col-sm-3 control-label">Date of Incident</label>
                            <div class="col-sm-3">
                                <input type="text" date-time data-ng-model="incident.dateOfIndicent" id="dateofincident" required view="hours" class="form-control" />
                            </div>
                            
                            <!--<label for="select2" class="col-sm-2 control-label">Team</label>
                            <div class="col-sm-3">
                                <select data-ui-select2 data-ng-required="true"
                                    data-ng-model="select2" id="select2" onloadeddata="select2()">
                                    <option data-ng-repeat="team in teams" value="{{team.id}}">{{team.title}}</option>
                                </select>
                            </div>-->
                            <input type="hidden" name="{{incident.id"}}" data-ng-model="incident.id" value="{{incidentId}}" />
                            <input type="hidden" name="{{incident.team_Id}}" data-ng-model="incident.team_id" value="{{incident.team_Id}}" />
                        </div>
                        <div class="form-group">
                                <label for="select2" class="col-sm-2 control-label">Team</label>
                                <div class="col-sm-8">
                                    <label data-ng-repeat="team in teams" class="radio-inline">
                                        <input type="radio" value="{{team.id}}" data-ng-model="incident.team_Id">{{team.title}}
                                    </label>
                                </div>
                            </div>
                        <div class="form-group">
                            <label for="locationlist" class="col-md-2 control-label">Locations</label>
                            <p></p>
                            <div class="col-md-8">
                                <ul id="locationlist" class="list-group list-group-flush" data-ng-repeat="location in incident.locations | orderBy:'Title' ">
                                <li class="list-group-item" >
                                 <a id="locationDetial" data-hmSwipeLeft="GotoLocation(location.id)" href="#/LocationDetail/{{location.id}}" title="Location Details">{{location.street}} ,  {{location.city}}</a>
                                       <button class="btn btn-default  text-right" title="delete"  data-ng-click="deleteLocation(location.id)" style="align-content: flex-end">
                                    <span class="glyphicon glyphicon-trash"></span>Delete
                            </button>
                                    </li>
                                </ul>
                            </div>
                            
                        </div>
                         <div class="col-md-2 col-md-1-offset">
                        <button class="btn btn-primary" title="editSave" data-ng-click="updateIncident(incident)" id="buttonSave" type="submit" data-ng-disabled="form.$pristine || form.$invalid" >Save
                        </button>
                    </div>
                        <div class="col-md-2 col-md-1-offset">
                        <a class="btn btn-primary" title="newLocation" id="newLocation"  href="#/LocationDetail/0/{{incidentId}}">
                            <span title="newLocation" class="glyphicon glyphicon-plus">NewLocation</span>
                        </a>
                    </div>
                        </form>
                </div>
                </div>
                    
            </div>
        </div>


    </div>
</div>



